﻿using Autodesk.AutoCAD.DatabaseServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dmo_lc_2.Utils
{
    class getLineTypeData
    {
        public static List<Dictionary<string, object>> getLineTypeDataById(Transaction tr , ObjectId lineTypeId)
        {
            List<Dictionary<string, object>> lineTypeList = new List<Dictionary<string, object>> { };
            LinetypeTableRecord linetypeTableRecord = (LinetypeTableRecord)tr.GetObject(lineTypeId, OpenMode.ForRead);
            int dashNum = linetypeTableRecord.NumDashes;
            for (int i = 0; i < dashNum; i++)
            {
                Dictionary<string, object> temp = new Dictionary<string, object> { };
                temp.Add("index", i);
                temp.Add("dashLength", linetypeTableRecord.DashLengthAt(i));
                double baseScale = Class1.LTSSCALE;
                double localScale = linetypeTableRecord.ShapeScaleAt(i);
                temp.Add("shapeScale", baseScale * localScale);
                temp.Add("IsScaledToFit", linetypeTableRecord.IsScaledToFit);
                lineTypeList.Add(temp);
            }

            return lineTypeList;
        }



    }
}
